﻿#include <iostream>
#include <list>
#include <algorithm>
using namespace std;

//int main()
//{
//    std::list<int> mylist1, mylist2;
//    std::list<int>::iterator it;
//
//    // set some initial values:
//    for (int i = 1; i <= 4; ++i)
//        mylist1.push_back(i);      // mylist1: 1 2 3 4
//
//    for (int i = 1; i <= 3; ++i)
//        mylist2.push_back(i * 10);   // mylist2: 10 20 30
//
//    it = mylist1.begin();
//    ++it;                         // points to 2
//
//    mylist1.splice(it, mylist2); // mylist1: 1 10 20 30 2 3 4
//    // mylist2 (empty)
//    // "it" still points to 2 (the 5th element)
//
//    list<int>::iterator pos = mylist1.begin();
//    while (pos != mylist1.end())
//    {
//        cout << *pos << " ";
//        ++pos;
//    }
//
//	return 0;
//}


//int main()
//{
//    std::list<int> mylist1, mylist2;
//
//    // set some initial values:
//    for (int i = 1; i <= 4; ++i)
//        mylist1.push_back(i);      // mylist1: 1 2 3 4
//
//    auto it = find(mylist1.begin(), mylist1.end(), 3);
//    mylist1.splice(mylist1.begin(), mylist1, it);
//
//    list<int>::iterator pos = mylist1.begin();
//    while (pos != mylist1.end())
//    {
//        cout << *pos << " ";
//        ++pos;
//    }
//
//    return 0;
//}

#include "List.h"
#include <algorithm>

int main()
{
	Greg::test_list6();

	return 0;
}

void Print(list<int>::iterator begin, list<int>::iterator end)
{
	list<int>::iterator it = begin;
	while (it != end)
	{
		cout << *it << " ";
		++it;
	}
	cout << endl;
}

int main111()
{
	Greg::test_list3();
	//int ar[] = { 0,1, 2, 3, 4,  5, 6, 7, 8, 9 };
	//int n = sizeof(ar) / sizeof(int);
	//list<int> mylist(ar, ar + n);
	//list<int>::iterator pos = find(mylist.begin(), mylist.end(), 5);

	//reverse(mylist.begin(), pos);
	//Print(mylist.begin(), pos);

	//reverse(pos, mylist.end());
	//Print(pos, mylist.end());


	//list<int>::const_reverse_iterator crit = mylist.crbegin();
	//while (crit != mylist.crend())
	//{

	//	cout << *crit << " ";
	//	++crit;
	//}

	//cout << endl;
	return 0;
}


#include <stdio.h>
int main222() {
	int n;
	printf("Input n(1<n<=5):");
	scanf_s("%d", &n);

	if (n <= 1 || n > 5) {
		printf("Error!\n");
		return 0;
	}

	int total = n - 1;

	for (int i = 0;i < n; i++)
	{
	
		total = total * n * (n - 1);
		total++;
		

	}

	printf("total=%d\n", total);
	return 0;
}

#include<stdio.h>
#include<math.h>
int getMin(int input);
int main22222()
{
	int input;
	printf("Input n(1<n<=5):");
	scanf_s("%d", &input);
	if (input > 5 || input <= 1)
	{
		printf("Error!\n");
		return 0;
	}
	int res = getMin(input);
	printf("y=%d\n", res);
	return 0;

}
int getMin(int input)
{
	int index = 6;
	int n;
	while (1)
	{
		index++;
		int temp = index;
		for (n = input; n > 0; n--)
		{
			if ((temp - 1) % input != 0) 
				break;

			temp = temp - 1 - (temp - 1) / input;
			if (n == 1)
				return index;
		}
	}
}

int main11() {
	int n;
	printf("Input n(1<n<=5):");
	scanf_s("%d", &n);

	if (n <= 1 || n > 5) {
		printf("Error!\n");
		return 0;
	}

	int total = n + 1;

	for (int i = total; ; i++)
	{
		int tmp = i;
		int j;
		for (j = n;j > 0; j--)
		{
			if ((tmp - 1) % n == 0 && tmp >= n)
			{
				tmp = (tmp - 1) * (n - 1) / n;
			}
			else
			{
				break;
			}
		}

		if (j == 0)
		{
			total = i;
			break;
		}
	}

	printf("total=%d\n", total);
	return 0;
}


